//
//  GDDataBase.h
//  Gunterapple
//
//  Created by 热带雨林 on 2021/1/29.
//  Copyright © 2021 热带雨林. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <FMDatabase.h>
#import <FMDatabaseQueue.h>

NS_ASSUME_NONNULL_BEGIN

@interface GDDataBase : NSObject

/**
创建数据库
 */
+ (void)creatSqliteWithSqliteName:(NSString *)sqliteName;

/**
创建表
 */
+ (void)creatTableName:(NSString *)tableName withTableStatusBlock:(void(^)(BOOL status))statusBlock;

/**
 插入单条数据
 */
+(void)addSqliteID:(NSString *)ID withName:(NSString *)tipStr withdescName:(NSString *)descStr withTableName:(NSString *)tableName success:(void(^)(BOOL status))success fail:(void(^)(BOOL status))fail;
/**
插入多条数据
 */
+(void)addSqliteTableName:(NSString *)tableName modelArray:(NSArray *)modelArray failArray:(void(^)(NSArray *failArray))failArray;
/**
 查询单条数据
 */
+ (void)selectSqliteWithTableName:(NSString *)tableName withSqliteID:(NSString *)ID success:(void(^)(NSDictionary * dic))success fail:(void(^)(BOOL status))fail;
/**
 查询多条数据
 */
+ (void)selectArraySqliteWithTableName:(NSString *)tableName withSqliteArray:(NSArray *)sqliteArray success:(void(^)(NSArray *array,NSArray *notSelectArray))success fail:(void(^)(BOOL status))fail;
/**
 查询表中所有数据
 */
+(void)selectSqliteAllModelWithTable:(NSString *)tableName success:(void(^)(NSArray *array))success fail:(void(^)(BOOL fail))fail;
/**
 删除数据库中表的某一条数据
 */
+(void)deleteSqliteWithTableName:(NSString *)tableName withSqliteID:(NSString *)ID success:(void(^)(BOOL status))success fail:(void(^)(BOOL status))fail;
/**
 删除数据库中表的多条数据
 */
+(void)deletaSqliteArrayWithTableName:(NSString *)tableName withSqliteArray:(NSArray *)array success:(void(^)(BOOL status))success fail:(void(^)(NSArray *failArray))fail;
/**
 删除数据库中表的所有数据
 */
+ (void)deleteSqliteAllDataWithTableName:(NSString *)tableName success:(void(^)(BOOL status))success fail:(void(^)(NSArray *array))fail;
/**
 修改数据库中单条数据
 */
+ (void)updataSqliteWithTableName:(NSString *)tableName withID:(NSString *)ID withTipStr:(NSString *)tipStr withDescStr:(NSString *)descStr success:(void(^)(BOOL status))success fail:(void(^)(BOOL fail))fail;
 
/**
 修改数据库中多条数据
 */
+ (void)updateSqlieWithTableName:(NSString *)tableName withArray:(NSArray *)array success:(void(^)(BOOL status))success fail:(void(^)(NSArray *failArray))failArray;

/**
 删除数据库中的表  使用此命令时要特别注意，因为一旦一个表被删除，表中所有信息也将永远丢失。
 */
+(void)dropTableWithTableName:(NSString *)tableName withTableStatus:(void(^)(BOOL status))statusBlock;

/**
 打开数据库
 */
+(BOOL)openSqlitestatusBlock:(void(^)(BOOL status))statusBlock;
/**
关闭数据库
 */
+(BOOL)closeSqlitestatusBlock:(void(^)(BOOL status))statusBlock;



@end


NS_ASSUME_NONNULL_END
